<?php
/**
 * @todo 利用__call()方法,实现fileAdd,apcAdd,xcacheAdd等缓存引擎接口
 * @author bluelevin(at)gmail.com
 *
 */
class LyCache {
	protected $options = array();
	static private $cacheFileInstance;
	function setOptions($options){
		$this->options = array_merge($this->options,$options);
	}
	function init(){

	}
	function fileAdd($key,$value,$ttl = null){
		return $this->getCacheFileInstance()->add($key,$value,$ttl);
	}
	function fileGet($key){
		return $this->getCacheFileInstance()->get($key);
	}
	function fileDel($key){
		$this->getCacheFileInstance()->del($key);
	}
	function getCacheFileInstance(){
		if (!isset(self::$cacheFileInstance)){
			self::$cacheFileInstance = new LyCacheFile();
			$options['ttl'] = $this->options['CacheFile_ttl'];
			$options['cacheDir'] = $this->options['CacheFile_cacheDir'];
			self::$cacheFileInstance->setOptions($options);
		}
		return self::$cacheFileInstance;
	}
}